package com.example.module.user.vo;


import com.example.module.user.DO.GetUserDO;
import com.example.module.user.DO.UserRegisterDO;
import lombok.Data;

import java.util.Date;

/**
 * @author ghy
 * @date 2025/08/06
 * @description 封装用户信息
 */
@Data
public class GetUserVO {
    /*
     * 用户id
     * */
    private Long userId;

    /*
     * 用户密码
     * */
    private String userPassword;

    /*
     * 用户名称
     * */
    private String userName;

    /*
     * 用户手机号
     * */
    private String userPhone;

    /*
     * 用户性别
     * */
    private String userSex;

    /*
     *  注册时间
     * */
    private Date userRegisterTime;

    /**
     * 将DO转VO
     *
     * @param getUserDO 用户注册表单
     * @return UserVO对象
     */
    public static GetUserVO DOToVO(GetUserDO getUserDO) {
        GetUserVO GetUserVO = new GetUserVO();
        GetUserVO.setUserId(getUserDO.getUserId());
        GetUserVO.setUserName(getUserDO.getUserName());
        GetUserVO.setUserPhone(getUserDO.getUserPhone());
        GetUserVO.setUserPassword(getUserDO.getUserPassword());
        if (getUserDO.getUserSex() != null) {
            switch (getUserDO.getUserSex()) {
                case "0":
                    GetUserVO.setUserSex("女");
                    break;
                case "1":
                    GetUserVO.setUserSex("男");
                    break;
                case "2":
                    GetUserVO.setUserSex("保密");
                    break;
                default:
                    GetUserVO.setUserSex(getUserDO.getUserSex());
                    break;
            }
        }
        GetUserVO.setUserRegisterTime(getUserDO.getUserRegisterTime());
        return GetUserVO;
    }


    /*
     * Getter and Setter
     * */

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserSex() {
        return userSex;
    }

    public void setUserSex(String userSex) {
        this.userSex = userSex;
    }

    public Date getUserRegisterTime() {
        return userRegisterTime;
    }

    public void setUserRegisterTime(Date userRegisterTime) {
        this.userRegisterTime = userRegisterTime;
    }
}
